//
//  GCMSBXJXQViewController.m
//  GeeCityManager
//
//  Created by 聚城科技 on 16/11/16.
//  Copyright © 2016年 聚城科技. All rights reserved.
//

#import "GCMSBXJXQViewController.h"
#import "GCMSheBeiRequst.h"
#import "GCMSBCaoZuoViewController.h"

@interface GCMSBXJXQViewController ()

@end

@implementation GCMSBXJXQViewController{

    NSMutableArray *uiData;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self downLoadData];
    
}

-(void)createUI{

    NSArray *titleArr = [NSArray arrayWithArray:uiData];
    for (int  i = 0; i < 4; i++) {
        UIButton *button  = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/4, 100 + 60 *i, SCREEN_WIDTH / 2, 40)];
        button.backgroundColor = [UIColor grayColor];
        [button setTitle:titleArr[i] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(onButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
    }
    
}
-(void)onButtonClick:(UIButton*)sender{

    UIButton * btn=(UIButton *)sender;
    NSString *str = btn.titleLabel.text;
    GCMSBCaoZuoViewController *czVC = [[GCMSBCaoZuoViewController alloc]init];
    czVC.type = str;
    czVC.sbid = self.courtId;
    [self.navigationController pushViewController:czVC animated:NO];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
    backItem.title = @"返回";
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationItem.backBarButtonItem = backItem;
    

}
-(void)downLoadData{

    [GCMSheBeiRequst postScanDataSuccess:^(id obj, NSError *err) {
        uiData = obj;
//        NSLog(@"%@",uiData);
        [self createUI];
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
